Adaptive sampling of pixels

ABSTRACT

Adaptive sampling of pixels is disclosed. In some embodiments, an initial rendering of a scene that determines texture at each portion of the scene is generated, and a ray traced rendering of the scene is generated by tracing an initial sample of rays. The following steps are iterated until all portions of the ray traced rendering satisfy a noise threshold: subtract the initial rendering of the scene from the ray traced rendering of the scene to determine a measure of noise at each portion of the ray traced rendering and trace another sample of rays in the ray traced rendering for each portion of the ray traced rendering that does not satisfy the noise threshold. The completed ray traced rendering is outputted. Different portions of the completed ray traced rendering are sampled with different numbers of samples of rays.

BACKGROUND OF THE INVENTION

In physically based rendering techniques such as path-tracing, pixels are typically uniformly sampled. Such indiscriminate sampling of pixels consumes processing resources and introduces latency that may be undesirable in many cases.

BRIEF DESCRIPTION OF THE DRAWINGS

Various embodiments of the invention are disclosed in the following detailed description and the accompanying drawings.

FIG. 1 illustrates an embodiment of a process for rendering a scene based on adaptive sampling.

DETAILED DESCRIPTION

The invention can be implemented in numerous ways, including as a process; an apparatus; a system; a composition of matter; a computer program product embodied on a computer readable storage medium; and/or a processor, such as a processor configured to execute instructions stored on and/or provided by a memory coupled to the processor. In this specification, these implementations, or any other form that the invention may take, may be referred to as techniques. In general, the order of the steps of disclosed processes may be altered within the scope of the invention. Unless stated otherwise, a component such as a processor or a memory described as being configured to perform a task may be implemented as a general component that is temporarily configured to perform the task at a given time or a specific component that is manufactured to perform the task. As used herein, the term ‘processor’ refers to one or more devices, circuits, and/or processing cores configured to process data, such as computer program instructions.

A detailed description of one or more embodiments of the invention is provided below along with accompanying figures that illustrate the principles of the invention. The invention is described in connection with such embodiments, but the invention is not limited to any embodiment. The scope of the invention is limited only by the claims, and the invention encompasses numerous alternatives, modifications, and equivalents. Numerous specific details are set forth in the following description in order to provide a thorough understanding of the invention. These details are provided for the purpose of example, and the invention may be practiced according to the claims without some or all of these specific details. For the purpose of clarity, technical material that is known in the technical fields related to the invention has not been described in detail so that the invention is not unnecessarily obscured.

In computer graphics, ray tracing is employed to render a three-dimensional scene with complex light interactions on a two-dimensional image plane. More specifically, ray tracing facilitates capturing a three-dimensional scene on an image sensor of a virtual camera viewing the scene from a particular position by tracing the paths of light rays and simulating their effects from encounters with objects comprising the scene. In order to only trace light rays that actually hit or intersect the image plane, ray tracing mathematically identifies and reproduces the path that each light ray follows in the reverse direction by tracing a path from a virtual camera position through each pixel of the image plane to its interactions with objects of the scene, including reflection, refraction, and/or shadow effects, to eventually its point of origin, i.e., a light source in the scene. Based on the determined path of each light ray and its interaction with scene objects, a corresponding pixel value (i.e., pixel color) is determined. In many cases, a plurality of samples of light rays is cast from pixels of the image plane into the scene to obtain more accurate pixel values. The path of a light ray is not deterministic but has constrained randomness. More samples of light rays through a pixel facilitate identifying a converging value for that pixel in a distribution of possible outcomes.

Uniformly sampling with a fixed number of samples per pixel is generally inefficient. In such cases, the number of samples required by pixels needing the most samples to converge is determined, and all pixels are uniformly sampled in a blanket fashion with this determined number of samples to ensure that a rendering with an acceptable quality or resolution is produced. The numbers of samples needed for convergence depend on the material properties of objects comprising a scene. Typically, optically complex materials exhibit more complicated interactions with light and thus generally require more samples to converge. For the same texture or pattern, diffused surfaces converge significantly more rapidly than shiny or specular surfaces. Thus, uniformly sampling all pixels using the same number of samples introduces substantial redundant sampling for pixels requiring considerably fewer samples to converge.

The aforementioned over sampling can be eliminated by sampling each pixel with only as many samples that are needed to achieve convergence. However, a pixel value may not converge if the pixel represents a complex pattern or texture that is inherently noisy. Thus, a noisy or non-convergent pixel value may arise from a deliberately noisy pattern or texture that the pixel represents and/or from insufficient sampling. In the case of the latter, the pixel needs to be further sampled with one or more additional rays. Over sampling can be prevented by distinguishing between noise or variance arising from texture versus from under sampling.

Adaptive sampling of pixels based on image data during ray tracing is disclosed. A scene that is desired to be rendered is not uniformly sampled during ray tracing. Rather, different portions of a scene under consideration are sampled differently. That is, pixels are sampled with different numbers of samples depending on the portions of an associated scene represented by the pixels. As further described in detail herein, an optimal number of samples for each pixel is intelligently determined based on foreknowledge of scene textures and identifying noise arising due to under sampling during ray tracing. More specifically, after each iteration (i.e., sample) of ray tracing, noise or variance in the ray traced rendering due to under sampling is identified by removing the noise or variance due to texture, and only pixels that do not satisfy a prescribed noise threshold are further sampled in one or more subsequent iterations until all pixels satisfy the prescribed noise threshold, i.e., until all pixels converge.

The given description generally describes ray tracing. However, the disclosed techniques may equivalently be employed with path tracing or any other ray based rendering technique that relies on tracing paths of light.

FIG. 1 illustrates an embodiment of a process for rendering a scene based on adaptive sampling. The rendering of the scene may comprise a still image or a frame of a video sequence. Generally, process 100 may be performed by a virtual camera having an adaptive sensor customized based on the scene being rendered. In various embodiments, process 100 may be performed by a processor coupled to a memory that provides instructions to the processor or a computer program product embodied in a non-transitory computer readable storage medium.

Process 100 starts at step 102 at which a specification of a scene to be rendered is received. For example, the scene to be rendered may comprise a view of a three-dimensional virtual environment from a particular virtual camera position and/or angle. The specification of the scene received at step 102 may comprise information about the scene such as scene content, objects, geometry, lighting, environment, textures, etc. The specification of the scene received at step 102 may further comprise a virtual camera position from which the scene is viewed.

At step 104, an initial rendering of the scene is generated that determines texture at each portion of the scene. The generated initial rendering of the scene comprises a low complexity and computational cost rendering that includes texture information but excludes advanced optical effects. In some embodiments, the initial rendering comprises a rasterization or a scanline rendering. For example, the initial rendering of the scene generated at step 104 may comprise an OpenGL (Open Graphics Library) rendering. In some embodiments, the initial rendering comprises a first intersection ray cast or traced rendering without any bounces. The initial rendering of the scene generated at step 104 comprises the correct brightness and textures but is devoid of higher order lighting effects, such as reflections, glares, shadows, etc.

At step 106, a ray traced rendering of the scene is generated by tracing an initial sample of rays. In various embodiments, the initial sample of rays may comprise one or more samples of rays. For example, in some embodiments, step 106 comprises generating the ray traced rendering by tracing a first sample of rays for each pixel. In other embodiments, it may be desirable to sample each pixel with at least a prescribed number of samples of rays. In such cases, step 106 comprises generating the ray traced rendering by tracing the prescribed number of samples of rays for each pixel.

At step 108, a measure of noise in the ray traced rendering is determined by subtracting the initial rendering of the scene from the ray traced rendering of the scene. In various embodiments, noise may be represented or measured using any appropriate metric such as variance of pixel values, visible noise in the difference image, SNR (signal-to-noise ratio), etc. Subtracting the initial rendering effectively removes texture, and, thus, any noise resulting from the texture. The noise remaining at step 108, therefore, arises from the optical properties of materials comprising the scene and their interactions with incident light. Effectively, the noise remaining at step 108 results from under sampling, i.e., from too few samples of rays.

At step 110, it is determined whether the noise at each portion of the ray traced rendering satisfies a prescribed noise threshold. That is, it is determined whether noise or variance in pixel values across one or more samples satisfies an acceptable threshold. More specifically, it is determined at step 110 whether a pixel value has converged. It is determined that a pixel value has converged when the pixel value does not substantially change (i.e., beyond the acceptable threshold) across a prescribed number of samples. Thus, it is determined at step 110 whether or not each pixel value has converged.

If it is determined at step 110 that one or more portions of the ray traced rendering do not satisfy the prescribed noise threshold, another sample of rays is traced for those portions in the ray traced rendering at step 112. That is, another sample of rays is traced at step 112 for each pixel that is found not to converge at step 110. Process 100 subsequently returns to step 108 and iterates steps 108-112 until all portions of the ray traced rendering satisfy the prescribed noise threshold, i.e., until all pixels are found to converge at step 110 according to a prescribed set of convergence criteria or conditions.

When it is determined at step 110 that all portions of the ray traced rendering satisfy the prescribed noise threshold (i.e., all pixel values have converged), the completed ray traced rendering is output at step 114, e.g., as a file or via a display. In most cases, different portions of the completed ray traced rendering that is output at step 114 are sampled with different numbers of samples of rays. Process 100 subsequently ends.

As described, a ray traced rendering is evaluated as it evolves after each sample. Specifically, an initial rendering that gives texture is subtracted out from the ray traced rendering after each sample to leave noise not originating from texture complexity but from the optical properties of materials interacting with light in the environment of the scene. Variance in the difference image diminishes with each additional sample. Different portions of the scene are affected differently with each sample. Ray tracing with additional samples is continued for only remaining noisy portions and ceased as soon as convergence occurs. Thus, an optimal number of samples of rays is employed per pixel, essentially eliminating over sampling and thus significantly reducing the processing resources needed and latency introduced during rendering.

Although the foregoing embodiments have been described in some detail for purposes of clarity of understanding, the invention is not limited to the details provided. There are many alternative ways of implementing the invention. The disclosed embodiments are illustrative and not restrictive. 

What is claimed is:
 1. A system, comprising: a processor configured to: generate an initial rendering of a scene that determines texture at each portion of the scene; generate a ray traced rendering of the scene by tracing an initial sample of rays; iterate the following until all portions of the ray traced rendering satisfy a noise threshold: determine a measure of noise at each portion of the ray traced rendering due to under sampling by removing noise due to texture by subtracting the initial rendering of the scene that determines texture from the ray traced rendering of the scene; and trace another sample of rays in the ray traced rendering for each portion of the ray traced rendering that does not satisfy the noise threshold; and output the completed ray traced rendering, wherein different portions of the completed ray traced rendering are sampled with different numbers of samples of rays; and a memory coupled to the processor and configured to provide the processor with instructions.
 2. The system of claim 1, wherein the system comprises a virtual camera having an adaptive sensor customized based on the scene being rendered.
 3. The system of claim 2, wherein each portion of the scene corresponds to a pixel of an image plane of the sensor.
 4. The system of claim 1, wherein each portion of the ray traced rendering corresponds to a pixel of an image comprising the rendering.
 5. The system of claim 1, wherein the processor is further configured to receive a specification of the scene to render.
 6. The system of claim 5, wherein the specification of the scene comprises information about one or more of scene content, objects, geometry, lighting, environment, textures, and virtual camera position from which the scene is viewed.
 7. The system of claim 1, wherein the scene comprises a view of a three-dimensional virtual environment.
 8. The system of claim 1, wherein the initial rendering of the scene that determines texture at each portion of the scene comprises a rasterization rendering or a scanline rendering.
 9. The system of claim 1, wherein the initial rendering of the scene that determines texture at each portion of the scene comprises an OpenGL (Open Graphics Library) rendering.
 10. The system of claim 1, wherein the initial rendering of the scene that determines texture at each portion of the scene comprises a first intersection ray cast or traced rendering without any bounces.
 11. The system of claim 1, wherein the initial sample of rays comprises a prescribed number of one or more samples of rays.
 12. The system of claim 1, wherein the noise threshold specifies convergence conditions.
 13. The system of claim 1, wherein the noise threshold comprises a measure of variance.
 14. The system of claim 1, wherein the noise threshold comprises a measure of visible noise.
 15. The system of claim 1, wherein the noise threshold comprises a measure of SNR (signal-to-noise ratio).
 16. The system of claim 1, wherein specular portions of the scene are sampled more than diffused portions of the scene.
 17. The system of claim 1, wherein the ray traced rendering comprises an image or a frame of a video sequence.
 18. The system of claim 1, wherein ray tracing comprises path tracing.
 19. A method, comprising: generating an initial rendering of a scene that determines texture at each portion of the scene; generating a ray traced rendering of the scene by tracing an initial sample of rays; iterating the following until all portions of the ray traced rendering satisfy a noise threshold: determining a measure of noise at each portion of the ray traced rendering due to under sampling by removing noise due to texture by subtracting the initial rendering of the scene that determines texture from the ray traced rendering of the scene; and tracing another sample of rays in the ray traced rendering for each portion of the ray traced rendering that does not satisfy the noise threshold; and outputting the completed ray traced rendering, wherein different portions of the completed ray traced rendering are sampled with different numbers of samples of rays.
 20. The method of claim 19, wherein the method comprises a virtual camera having an adaptive sensor customized based on the scene being rendered.
 21. The method of claim 20, wherein each portion of the scene corresponds to a pixel of an image plane of the sensor.
 22. The method of claim 19, wherein each portion of the ray traced rendering corresponds to a pixel of an image comprising the rendering.
 23. The method of claim 19, further comprising receiving a specification of the scene to render.
 24. The method of claim 23, wherein the specification of the scene comprises information about one or more of scene content, objects, geometry, lighting, environment, textures, and virtual camera position from which the scene is viewed.
 25. The method of claim 19, wherein the scene comprises a view of a three-dimensional virtual environment.
 26. The method of claim 19, wherein the initial rendering of the scene that determines texture at each portion of the scene comprises a rasterization rendering or a scanline rendering.
 27. The method of claim 19, wherein the initial rendering of the scene that determines texture at each portion of the scene comprises an OpenGL (Open Graphics Library) rendering.
 28. The method of claim 19, wherein the initial rendering of the scene that determines texture at each portion of the scene comprises a first intersection ray cast or traced rendering without any bounces.
 29. The method of claim 19, wherein the initial sample of rays comprises a prescribed number of one or more samples of rays.
 30. The method of claim 19, wherein the noise threshold specifies convergence conditions.
 31. The method of claim 19, wherein the noise threshold comprises a measure of variance.
 32. The method of claim 19, wherein the noise threshold comprises a measure of visible noise.
 33. The method of claim 19, wherein the noise threshold comprises a measure of SNR (signal-to-noise ratio).
 34. The method of claim 19, wherein specular portions of the scene are sampled more than diffused portions of the scene.
 35. The method of claim 19, wherein the ray traced rendering comprises an image or a frame of a video sequence.
 36. The method of claim 19, wherein ray tracing comprises path tracing.
 37. A computer program product embodied in a non-transitory computer readable storage medium and comprising computer instructions for: generating an initial rendering of a scene that determines texture at each portion of the scene; generating a ray traced rendering of the scene by tracing an initial sample of rays; iterating the following until all portions of the ray traced rendering satisfy a noise threshold: determining a measure of noise at each portion of the ray traced rendering due to under sampling by removing noise due to texture by subtracting the initial rendering of the scene that determines texture from the ray traced rendering of the scene; and tracing another sample of rays in the ray traced rendering for each portion of the ray traced rendering that does not satisfy the noise threshold; and outputting the completed ray traced rendering, wherein different portions of the completed ray traced rendering are sampled with different numbers of samples of rays.
 38. The computer program product of claim 37, wherein the computer program product comprises a virtual camera having an adaptive sensor customized based on the scene being rendered.
 39. The computer program product of claim 38, wherein each portion of the scene corresponds to a pixel of an image plane of the sensor.
 40. The computer program product of claim 37, wherein each portion of the ray traced rendering corresponds to a pixel of an image comprising the rendering.
 41. The computer program product of claim 37, further comprising computer instructions for receiving a specification of the scene to render.
 42. The computer program product of claim 41, wherein the specification of the scene comprises information about one or more of scene content, objects, geometry, lighting, environment, textures, and virtual camera position from which the scene is viewed.
 43. The computer program product of claim 37, wherein the scene comprises a view of a three-dimensional virtual environment.
 44. The computer program product of claim 37, wherein the initial rendering of the scene that determines texture at each portion of the scene comprises a rasterization rendering or a scanline rendering.
 45. The computer program product of claim 37, wherein the initial rendering of the scene that determines texture at each portion of the scene comprises an OpenGL (Open Graphics Library) rendering.
 46. The computer program product of claim 37, wherein the initial rendering of the scene that determines texture at each portion of the scene comprises a first intersection ray cast or traced rendering without any bounces.
 47. The computer program product of claim 37, wherein the initial sample of rays comprises a prescribed number of one or more samples of rays.
 48. The computer program product of claim 37, wherein the noise threshold specifies convergence conditions.
 49. The computer program product of claim 37, wherein the noise threshold comprises a measure of variance.
 50. The computer program product of claim 37, wherein the noise threshold comprises a measure of visible noise.
 51. The computer program product of claim 37, wherein the noise threshold comprises a measure of SNR (signal-to-noise ratio).
 52. The computer program product of claim 37, wherein specular portions of the scene are sampled more than diffused portions of the scene.
 53. The computer program product of claim 37, wherein the ray traced rendering comprises an image or a frame of a video sequence.
 54. The computer program product of claim 37, wherein ray tracing comprises path tracing. 